﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LINQtoLDAPDemo_Setup.ExcelTestData
{
    public class ExcelEmployee
    {
        #region Properties
        public int EmployeeID { get; set; }
        public string LastName { get; set; }
        public string FirstName { get; set; }
        public string Title { get; set; }
        public string TitleOfCourtesy { get; set; }
        public DateTime? BirthDate { get; set; }
        public DateTime? HireDate { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string Region { get; set; }
        public string PostalCode { get; set; }
        public string Country { get; set; }
        public string HomePhone { get; set; }
        public string Extension { get; set; }
        public string Notes { get; set; }
        public string ReportsTo { get; set; } // int?
        public string PhotoPath { get; set; }
        #endregion

        public Employee ToEmployee()
        {
            Employee _employee = new Employee()
            {
                LastName = this.LastName,
                FirstName = this.FirstName,
                Title = this.Title,
                TitleOfCourtesy = this.TitleOfCourtesy,
                BirthDate = this.BirthDate,
                HireDate = this.HireDate,
                Address = this.Address,
                City = this.City,
                Region = this.Region,
                PostalCode = this.PostalCode,
                Country = this.Country,
                HomePhone = this.HomePhone,
                Extension = this.Extension,
                Notes = this.Notes,
                ReportsTo = this.ReportsTo == null || this.ReportsTo.Equals("NULL") ? (int?)null : (int?)int.Parse(this.ReportsTo),
                PhotoPath = this.PhotoPath
            };

            return _employee;
        }
    }
}
